function initMap() {
	// Variable initialization
	var center = new GLatLng(38.987284, -76.944058);
	var div = document.getElementById("map");

	// Setup map
	var map = new GMap2(div);
	map.setCenter(center, 16);

	// Add controls
	map.addControl(new GLargeMapControl());
	map.addControl(new GMapTypeControl());

	// Click handling
	listener = GEvent.addListener(map, "click", function(overlay, point) {
		var calendarCode = '<div id="placeEvent" class="placement"><div class="titleLabel">Place Event</div><form name="placeEventForm">\n<table style="width: 440px;">\n<tr><th>What</th><td><input type="text" name="title" style="width: 97%;" /></td></tr>\n<tr><th>When</th><td><input type="text" name="startDate" size="10" /> <input type="text" name="startTime" size="7" /> to <input type="text" name="endTime" size="7" /> <input type="text" name="endDate" size="10" /></td></tr>\n<tr><th></th><td>Repeats <select><option selected="selected">Does not repeat</option><option>Daily</option><option>Every weekday (Mon-Fri)</option><option>Every Mon., Wed., and Fri.</option><option>Every Tues., and Thurs.</option><option>Weekly</option><option>Monthly</option><option>Yearly</option></select></tr>\n<tr><th>Description</th><td><textarea name="desc" style="width: 97%;"></textarea></td></tr><tr><td colspan="2"><input type="button" value="Place Event" onclick="makeEvent(\'' + point + '\')" /></td></tr></table></form></div>';
		var contactsCode = '<div id="placeContact" class="placement"><div class="titleLabel">Place Contact</div><form name="placeContactForm">\n<table style="width: 440px;">\n<tr><th>Name</th><td><input type="text" name="name" style="width: 97%;" /></td></tr><tr><th>Email</th><td><input type="text" name="email" style="width: 97%;" /></td></tr><tr><td colspan="2"><input type="button" value="Place Contact" onclick="makeContact(\'' + point + '\')" /></td></tr></table></form></div>';
	    if (overlay && overlay instanceof GMarker) {
			// Marker clicked
	    } else if (point && google.accounts.user.checkLogin(contactScope) && google.accounts.user.checkLogin(calendarScope)) {
			map.openInfoWindowHtml(point, calendarCode + contactsCode);
	    } else if (point && google.accounts.user.checkLogin(contactScope)) {
			map.openInfoWindowHtml(point, contactsCode);
	    } else if (point && google.accounts.user.checkLogin(calendarScope)) {
			map.openInfoWindowHtml(point, calendarCode);
	    }
	});
	
	var markers = new Array();
	
	for (i = 0; i < contacts.length; i++) {
		latlng = contacts[i].getContent();
		console.log(latlng);
		
		if (latlng && latlng.slice(0, 6) == "latlng") {
			coords = latlng.split(",");
			
			if (coords.length == 2) {
				lat = Number(coords[0].slice(7));
				lng = Number(coords[1].slice(0, -1));
				
				markers.push(new GMarker(new GLatLng(lat, lng)));
				map.addOverlay(markers[markers.length - 1]);
			}
		}
	}
}

function toggleHeight(element) {
	document.getElementById("placeEvent").style.height = "32px";
	document.getElementById("placeContact").style.height = "32px";

	if (element.style.height == '32px') {
		element.style.height = 'auto';
	} else {
		element.style.height = '32px';
	}
}